from selenium import webdriver
import time

driver = webdriver.Chrome()

driver.get('https://www.baidu.com/')

driver.execute_script("window.open('https://www.douban.com/')")

# 打印当前的URL地址
print(driver.current_url)
# 切换界面
# driver.switch_to_window()
driver.switch_to.window(driver.window_handles[2])
print(driver.current_url)
# time.sleep(2)

# driver.find_element_by_id('kw').send_keys('python')

# driver.close()

# driver.quit()